/*
 * @Author: Setsuna
 * @Email: setsuna.xyz@qq.com
 * @FilePath: \src\pages\QuotaManage\Report\InventoryDynamicReport\components\Colock.tsx
 * @Date: 2022-01-23 21:25:47
 * @LastEditTime: 2022-01-23 21:34:04
 */
import React, { memo, useState, useEffect } from 'react'
import dayjs from 'dayjs'

const FORMAT = 'YYYY年MM月DD HH:mm:ss'

const Header = memo(() => {
  const [time, setTime] = useState(+new Date())

  useEffect(() => {
    const t = setInterval(() => {
      setTime(+new Date())
    }, 1000)
    return () => clearInterval(t)
  }, [])
  return <div className="date-time-wrap">{dayjs(time).format(FORMAT)}</div>
})

export default React.memo(Header)
